package main

import (
	"flag"

	"git.oschina.net/ant180/scan/config"
	"git.oschina.net/ant180/scan/control"
	"github.com/xlvector/dlog"

	_ "net/http/pprof"
)

func main() {
	fn := flag.String("f", "config.json", "config file")
	flag.Parse()

	conf := &config.Config{}
	err := config.ReadConfig(*fn, conf)
	if err != nil {
		dlog.Fatal("config file fail! %v", err)
	}
	dlog.Info("config: %#v", conf)
	w, err := control.NewWorker(conf)
	if err != nil {
		dlog.Fatal("new worker fail! %v", err)
	}

	w.StartAndServe()
}
